package com.waiting.leetcode;

/**
 * @Description
 * @Author bjweitingting
 * @Date 2019/3/27
 **/
public class LongestContinuousIncreasingSubsequence674 {
    public static void main(String[] args) {
        int[] nums = {1, 3, 5, 4, 7};
        int result = findLengthOfLCIS(nums);
        System.out.println(result);
    }

    public static int findLengthOfLCIS(int[] nums) {
        if (nums == null || nums.length < 1) {
            return 0;
        }
        int maxLength = 1, currentLength = 1;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > nums[i - 1]) {
                currentLength++;
            } else {
                maxLength = maxLength > currentLength ? maxLength : currentLength;
                currentLength = 1;
            }
        }
        maxLength = maxLength > currentLength ? maxLength : currentLength;
        return maxLength;
    }

}
